import { add } from "./utils/other.js";
const json = require("./assets/static/index.json");

console.log(add(1, 2), json);
import("./style/index.less");

import pic from "./assets/img/1.jpg";
console.log(pic);
let img = new Image();
img.src = pic;
let root = document.getElementById("root");
root.append(img);
// console.log('hello webpack');

/* import * as OfflinePluginRuntime from 'offline-plugin/runtime';
OfflinePluginRuntime.install({
  onUpdateReady () {
    OfflinePluginRuntime.applyUpdate()
  },
  onUpdated () {
    window.location.reload()
  }
})
 */

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function () {
    navigator.serviceWorker.register('/service-worker.js', { scope: '/' })
      .then(function (registration) {
        // 注册成功
        console.log('ServiceWorker registration successful with scope: ', registration.scope);
      })
      .catch(function (err) {
        // 注册失败:(
        console.log('ServiceWorker registration failed: ', err);
      });
  });
}